package com.serkol.ams.controller.api;


import com.serkol.ams.bean.Result;
import com.serkol.ams.service.NoticeService;
import com.serkol.ams.service.NotifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("api/notify")
public class NotifyApiController {

    @Autowired
    private NotifyService notifyService;



    @Autowired
    private NoticeService noticeService;

    @GetMapping("/myNotify")
    public Result myNotify() {

        Map<String, Object> systemNotify = notifyService.mySystemNotify();
        Map<String, Object> map = new HashMap<>();
        List<String> list = new ArrayList<>();
        map.put("sys", systemNotify);
        map.put("users", list);

        return Result.ok(map);
    }

    //findByMyList
    @GetMapping("/findByMyList")
    public Result findByMyList(@RequestParam(value = "type", defaultValue = "0") int type) {

        List<Map<String, Object>> dataList = notifyService.findByMyList(type);


        return Result.ok(dataList);
    }
}
